<?php

/*

Process Add Topic (global_add_topic.pro.php)

*/
ob_start();
$rank_check = 3;
include "global.inc.php";

if ($getInfo[premium] == "1")
{
	$colors = "$text_color, $bg_color, $bg_image.gif";
}

if ($rank < 4)
{
	$add_subject = badwords(strip_tags($add_subject,"<font>"));
}
else
{
	$add_subject = badwords(strip_tags($add_subject,"<b><i><u><font>"));
}

if (!$text_color) { $text_color = "#000000"; }

$add_message = format(smilies(badwords(strip_tags($add_message,"<b><i><u><a><font>"))),"$text_color");

if ((!$add_message) OR (!$add_subject))
{
	die(header(error("global_add_topic.php?game=$game", "Please do not leave the message or subject blank.")));
}

mysql_query("INSERT INTO global_subjects (subject,author,last_post_by,last_post_at) VALUES ('$add_subject','$userid','$userid','$timestamp')");

mysql_query("INSERT INTO global_topics (id,message,timestamp,colors) VALUES ('" . mysql_insert_id() . "','$add_message','$timestamp','$colors')");

mysql_query("UPDATE members2 SET global_post_count=$getInfo[global_post_count]+1 WHERE id = '$userid'");

header(error("global_forums.php?game=$game","Your message has been posted."));

?>